const state = {
  credit: 0, // 积分
  signin_state: 0
}

const Mutation = {
  SET_INTEGRAL_INIT: 'SET_INTEGRAL_INIT'
}
const mutations = {
  // 设置积分的分数
  [Mutation.SET_INTEGRAL_INIT](state, data) {
    state.credit = data.count
    state.signin_state = data.state
  }
}

const Action = {
  SET_INTEGRAL_INIT: 'SET_INTEGRAL_INIT'
}
const actions = {
  [Action.SET_INTEGRAL_INIT]({ commit }, data) {
    commit(Mutation.SET_INTEGRAL_INIT, data)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
